package main

import "fmt"

//三方登录方式很多 qq  微信

type Sflogin interface {
	//获取url
	Geturl() string
	//回调
	Callback()
}

//qq
type Qq struct {
	appid  string
	secret string
}

func (qq Qq) Geturl() string {
	url := "http://qq.com.coma/appid=" + qq.appid + "&asfsdf=" + qq.secret
	return url
}

func (qq Qq) Callback() {
	fmt.Println("qq回调操作")
}

//qq
type Weibo struct {
	name   string
	secret string
}

func (wb Weibo) Geturl() string {
	url := "http://wb.com.coma/appid=" + wb.name + "&asfsdf=" + wb.secret
	return url
}

func (wb Weibo) Callback() {
	fmt.Println("weibo回调操作")
}

//获取url都用这个方法
func Dogeturl(sf Sflogin) string {
	return sf.Geturl()
}

func DocallBack(sf Sflogin) {
	sf.Callback()
}

func main() {
	qq := &Qq{appid: "234234", secret: "234234"}
	res := Dogeturl(qq)
	fmt.Println(res)
	wb := &Weibo{name: "123", secret: "234"}
	res1 := Dogeturl(wb)
	fmt.Println(res1)
}
